Introduction to JavaScript

JavaScript is a scripting language developed by Netscape.

JavaScript works in all major browsers that are version 3.0 or higher.


What You Should Already Know

Before you continue you should have a basic understanding of the following:

If you want to study these subjects first, go to our Home Page.


What is JavaScript?


How Does it Work?

When a JavaScript is inserted into an HTML document, the Internet browser will read the HTML and interpret the JavaScript. The JavaScript can be executed immediately or at a later event.


What can a JavaScript Do?

JavaScript gives HTML designers a programming tool

HTML authors are normally not programmers, but JavaScript is a very light programming language with a very simple syntax! Almost anyone can start putting small "snippets" of code into their HTML documents.

JavaScript can put dynamic text into an HTML page

A JavaScript statement like this: document.write("<h1>" + name + "</h1>") can write a variable text into the display of an HTML page, just like the static HTML text: <h1>Bill Gates</h1> does.

JavaScript can react to events

A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element.

JavaScript can read and write HTML elements

A JavaScript can read an HTML element and change the content of an HTML element.

JavaScript can be used to validate data

JavaScripts can be used to validate data in a form before it is submitted to a server. This function is particularly well suited to save the server from extra processing.